import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';


class MenuController extends GetxController{

  List<NavigationPaneItem> _menuList=[];
  List<NavigationPaneItem> get menuList =>_menuList;

  set menuList(menuList){
    _menuList = [];
    for(var i =0;i<menuList.length;i++){
      var menu = menuList[i];
      if(menu["children"].length>0){
        _menuList.add(PaneItemSeparator());
        _menuList.add(PaneItemHeader(header: Text(menu["name"].toString())),);
        for(var j =0;j<menu["children"].length;j++){
          var subMenu = menu["children"][j];
          _menuList.add(PaneItem(
            icon: const Icon(FluentIcons.settings),
            title: Text(subMenu["name"].toString()),
          ));
        }
      }else{
        _menuList.add(PaneItem(
          icon: const Icon(FluentIcons.settings),
          title: Text(menu["name"].toString()),
        ));
      }
    }
    update();
  }
  void onReady(){

    super.onReady();
  }

}